#%%
import ReUseDetection

#%%

bin_paths = [
    "dataset/zlib1.2.8_multi_optimize/libz.so.1.2.8.O0",
    "dataset/zlib1.2.8_multi_optimize/libz.so.1.2.8.O1",
    "dataset/zlib1.2.8_multi_optimize/libz.so.1.2.8.O2",
    "dataset/libpng-1.6.37/build/libpng16.so.16.37.0",
]

#%%

my_cfgs = [ReUseDetection.MyCFG(p) for p in bin_paths]

#%%

norm_scores = []
dismatch_ratios = []
matchs = []

for i in range(0, 3):
    _norm_scores = ReUseDetection.compareCFG(my_cfgs[i], my_cfgs[3], NUM_THREADS=2)
    norm_scores.append(_norm_scores)
    _ratio, _match = ReUseDetection.my_print(_norm_scores, my_cfgs[i], my_cfgs[3])
    dismatch_ratios.append(_ratio)
    matchs.append(_match)


#%%

my_cfg1 = my_cfgs[0]
my_cfg2 = my_cfgs[3]

# %%

func_name = "sub_402030"
my_func_node = my_cfg1.get_by_name(func_name)
my_func_node2 = my_cfg2.get_by_name(func_name)

ReUseDetection.compare(my_func_node, [my_func_node2])


# %%

ReUseDetection.print_func_node(my_cfg1.get_by_name("crc32").func_node)


#%%

ReUseDetection.print_func_node(my_cfg2.get_by_name("png_write_chunk_header").func_node)



# %%
